File manager - Edit - /home/autoph/public_html/projects/ahg-event/assets/template-03992492.js
Back
import{b as d,L as x,C as M,I as O,B as L,a as B,l as k,h as S}from"./Loading-aa057cf2.js";import{P as I}from"./Pagination-75845331.js";import{i as T}from"./logo-black-e64f52b7.js";import{M as R}from"./index-2e0b4a49.js";import{_ as V,k as p,w as i,r as a,o as u,b as r,a as s,g,c as m,f as D,d as N,t as f}from"./index-6d9e3b55.js";const c="https://registration-api.autohub.ph/api/v1/sms-template",Q={fetchRecords(e={}){return d.get(`${c}`,{params:e})},fetchRecord(e){return d.get(`${c}/${e}`)},async create(e){return d.post(`${c}`,e)},async update(e,l){return d.put(`${c}/${e}`,l)},async remove(e){return d.delete(`${c}/${e}`)}},E={components:{Layout:x,Card:M,InputGroup:O,Pagination:I,Button:L,Loading:B,Modal:R},data(){return{imgLogo:T,eventOptions:null,state:{isEdit:!1,isLoading:!1,isMounted:!1,isResetError:!1,isSubmitted:!1,showModal:!1,isDeleting:!1},templateContent:null,totalItems:0,items:[],error:[],perPageOptions:[{value:"10",label:"10"},{value:"20",label:"20"},{value:"50",label:"50"},{value:"100",label:"100"}],searchQuery:null,currentPage:1,serverOptions:{rowsPerPage:10,sortBy:"id",sortType:"desc",event:null},state:{isLoading:!1,showModal:!1}}},watch:{serverOptions:{handler(){this.fetchRecords()},deep:!0},searchQuery:k.debounce(function(){this.fetchRecords()},800)},computed:{perPage:function(){return this.serverOptions.rowsPerPage},filteredEventOptions:function(){return this.eventOptions?this.eventOptions.filter(e=>[30,31,32,33,34,35].includes(e.value)):[]},columns:function(){let e=[];return e.push({label:"ID",field:"id",tdClass:"text-center w-[20px]",sortable:!1}),e.push({label:"Name",field:"name",tdClass:"",sortable:!1}),e.push({label:"Content",field:"content",tdClass:"",sortable:!1}),e}},methods:{formatDate(e,l=null){return S(e).format(l??"YYYY-MM-DD hh:mma")},async fetchRecords(){this.state.isLoading=!0,await Q.fetchRecords({keyword:this.searchQuery,sortBy:this.serverOptions.sortBy,sortType:this.serverOptions.sortType}).then(e=>{e.status==200&&(this.items=e.data.data,this.totalItems=e.data.total)}).finally(()=>{this.state.isLoading=!1})},viewContent(e){this.templateContent=e,this.state.showModal=!0},addBreaks(e){return e.replace(/\r\n/g,"<br>")},closeModal(){this.state.showModal=!1},handlePageChange(e){console.log(e),console.log(this.currentPage),this.currentPage!=e&&(this.currentPage=e)},handlePerPageChange(e){this.serverOptions.rowsPerPage=e},onSortChange(e){console.log(e),e[0].type!="none"&&(this.serverOptions.sortBy=e[0].field,this.serverOptions.sortType=e[0].type)}},created(){this.fetchRecords()}},Y={class:"grid gap-1 mb-2"},G={class:"grid lg:grid-cols-2 gap-3"},z={class:"grid lg:grid-cols-2 gap-3"},H={key:0,class:"flex gap-1"},U={key:1,class:"flex gap-1"},j={class:"py-4 px-3 flex justify-end"},F={class:"flex gap-1 mb-4"},q=s("div",null,"Name:",-1),A={class:"text-md text-indigo-800"},J=s("div",{class:"mb-2"}," Content: ",-1),K={class:"border border-slate-400 p-8 w-full"},W=["innerHTML"];function X(e,l,Z,$,t,n){const _=a("InputGroup"),v=a("Loading"),h=a("Button"),C=a("Pagination"),b=a("vue-good-table"),P=a("Card"),y=a("Modal"),w=a("Layout");return u(),p(w,null,{default:i(()=>[r(P,null,{default:i(()=>[s("header",Y,[s("div",G,[s("div",z,[s("div",null,[r(_,{modelValue:t.searchQuery,"onUpdate:modelValue":l[0]||(l[0]=o=>t.searchQuery=o),class:"w-full border border-green-500 focus:border-green-500 rounded",placeholder:"Search",type:"text",prependIcon:"heroicons-outline:search",merged:""},null,8,["modelValue"])])])])]),s("section",null,[t.state.isLoading?(u(),p(v,{key:0,searching:!0,text:"Fetching records"})):g("",!0),r(b,{columns:n.columns,styleClass:"vgt-table bordered table-head lesspadding v-middle",mode:"remote",rows:t.items,search:!0,"sort-options":{enabled:!0},"pagination-options":{enabled:!0},onSortChange:n.onSortChange,"max-height":"600px"},{"table-row":i(o=>[o.column.field=="status"?(u(),m("div",H,[r(h,{class:D([o.row.status==1?"bg-green-500":"bg-amber-500","btn p-1 text-sm"])},{default:i(()=>[N(f(o.row.status==1?"Complete":"Pending"),1)]),_:2},1032,["class"])])):g("",!0),o.column.field=="content"?(u(),m("div",U,[r(h,{onClick:ee=>n.viewContent(o.row),class:"btn btn-primary",text:"View"},null,8,["onClick"])])):g("",!0)]),"pagination-bottom":i(o=>[s("div",j,[r(C,{total:t.totalItems,current:t.serverOptions.page,"per-page":t.serverOptions.rowsPerPage,onPageChanged:n.handlePageChange,pageChanged:o.pageChanged,perPageChanged:t.serverOptions.rowsPerPage,enableSelect:"",perPageOptions:t.perPageOptions,onChangePerPage:n.handlePerPageChange},null,8,["total","current","per-page","onPageChanged","pageChanged","perPageChanged","perPageOptions","onChangePerPage"])])]),_:1},8,["columns","rows","onSortChange"])])]),_:1}),r(y,{title:"Template Content",activeModal:t.state.showModal,centered:e.centered,scrollContent:!1,onClose:n.closeModal,sizeClass:"w-1/2"},{default:i(()=>[s("div",F,[q,s("div",A,f(t.templateContent.name),1)]),J,s("div",K,[s("div",{class:"w-full",innerHTML:n.addBreaks(t.templateContent.message_body)},null,8,W)])]),_:1},8,["activeModal","centered","onClose"])]),_:1})}const re=V(E,[["render",X]]);export{re as default};
| ver. 1.4 |
.
| PHP 8.1.32 | Generation time: 0 |
proxy
|
phpinfo
|
Settings